<?php
define('STATUS', 'Status');
define('LINK', 'Link');
define('SHOUTOUT', 'Shoutout');
define('URL_SHAREPOST', '/share/post');

?>
<!-- Share Entry -->
<section>
	<h2>Share something…</h2>
	<?php echo Common::renderFlashMessage() ?>
	<form method="post" name="formShare" action="<?php echo URL_SHAREPOST;  ?>">
		<p><textarea id="share" name="share" rows="3"></textarea></p>
		<p>
			Type: <select id="type" name="type">
			<option value=<?php echo SHOUTOUT; ?>><?php echo SHOUTOUT; ?></option>
			<option value=<?php echo STATUS; ?>><?php echo STATUS; ?></option>
			<option value=<?php echo LINK; ?>><?php echo LINK; ?></option>
			</select>
			<input type="submit" value="Post" name="submitShare">
		</p>
	</form>
</section>
<!-- Recent Activity -->
<section>
	<h2>Recent Activity</h2>
   <?php 
   if(count($this->recentActivities)) :
   foreach($this->recentActivities as $activity): 
   ?>
   <article class="activity">
      <address><a href="/user/profile/<?php echo $activity['username'] ?>"><?php echo $activity['username']; ?></a>
         <?php 
         $stype = strtolower($activity['share_type']);
         $way = '';
         if($stype == 'message') $way = 'says';
         elseif($stype == 'shoutout') $way = 'shouts';
         elseif($stype == 'status') $way = 'changed status';
         elseif($stype == 'link') $way = 'shared a link';
         ?>
         
         <?php echo $way ?>:
        </address>
      <q><span class="quote"><?php echo substr( Common::sanitizeHtml($activity['share_text'], '<img><a>'), 0, 500); ?></span></q>
      <p><time>posted on: <?php echo DataHelper::setDateFormat($activity['share_datetime']); ?></time></p>
   </article>
   <?php
   endforeach;
   else :
   ?>
   <p>No recent Activity</p>
   <?php endif ?>
</section>